package light.head.model.inv;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.Formula;
/**
 * 来往单位联系人
 * @author yuleidian
 *
 */
@Entity
@Table
public class InvBusinessContacts implements Serializable{
	private static final long serialVersionUID = 7384218159949138934L;
	private Integer code;
	private Integer isc;					// 来往单位编号
	private String name;				// 联系人名称
	private String phone;				// 联系电话
	private Integer qq;					// QQ号
	private Integer cu;					// 创建人
	private Date ct;					// 创建时间
	private Integer oc;					// 机构编号
	private Boolean deleted = false;	// 是否删除
	private Boolean dc = false;			// 是否默认联系人
	
	//@Formula
	private String cn;					// 创建人
	private String on;					// 机构名称
	
	
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column
	public Integer getCode() {
		return code;
	}

	@Column
	public String getName() {
		return name;
	}
	@Column
	public String getPhone() {
		return phone;
	}
	@Column
	public Integer getQq() {
		return qq;
	}
	@Column
	public Integer getCu() {
		return cu;
	}
	@Temporal(TemporalType.TIMESTAMP)
	@Column(updatable = false, nullable = false)
	public Date getCt() {
		return ct;
	}
	@Column
	public Integer getOc() {
		return oc;
	}
	@Column
	public Boolean getDeleted() {
		return deleted;
	}
	@Column
	public Boolean getDc() {
		return dc;
	}
	@Column
	public Integer getIsc() {
		return isc;
	}
	
	@Formula("(SELECT u.realName FROM UserInfo u WHERE u.code = cu)")
	public String getCn() {
		return cn;
	}
	@Formula("(SELECT o.name FROM Organ o WHERE o.code = oc)")
	public String getOn() {
		return on;
	}
	
	


	public void setIsc(Integer isc) {
		this.isc = isc;
	}

	public void setCode(Integer code) {
		this.code = code;
	}

	public void setName(String name) {
		this.name = name;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public void setQq(Integer qq) {
		this.qq = qq;
	}

	public void setCu(Integer cu) {
		this.cu = cu;
	}

	public void setCt(Date ct) {
		this.ct = ct;
	}
	public void setOc(Integer oc) {
		this.oc = oc;
	}
	public void setDeleted(Boolean deleted) {
		this.deleted = deleted;
	}
	public void setDc(Boolean dc) {
		this.dc = dc;
	}
	public void setCn(String cn) {
		this.cn = cn;
	}
	public void setOn(String on) {
		this.on = on;
	}
	
	
	
}
